package com.learn.project2.controller.wx.comment;

import com.learn.project2.model.bo.wx.comment.CommentPostBO2;
import com.learn.project2.model.vo.wx.comment.CommentCountVO2;
import com.learn.project2.model.vo.wx.comment.CommentListVO2;
import com.learn.project2.model.vo.wx.comment.CommentPostVO2;
import com.learn.project2.service.wx.comment.CommentService2;
import com.learn.project2.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname CommentController2 评论
 * @author王茁
 * @Date 2022/1/10 14:05
 */
@RestController
@RequestMapping("wx/comment")
public class CommentController2 {
    @Autowired
    CommentService2 commentService2;

    @RequestMapping("list")
    /**
     * @description: 评论列表
     * @author wangzhuo 本地测试成功
     * @date 2022-01-10 14:38
     * @version 1.0
     */
    public Result list(Integer valueId,Byte type,Integer limit,Integer page,Integer showType){
        CommentListVO2 commentListVO2 = commentService2.getList(valueId, type, limit, page, showType);
        return Result.ok(commentListVO2);
    }

    @RequestMapping("count")
    /**
     * @description:  评论数
     * @author wangzhuo 本地测试成功
     * @date 2022-01-10 16:41
     * @version 1.0
     */
    public Result count(Integer valueId,Byte type){
        CommentCountVO2 commentCountVO2 = commentService2.getCount(valueId, type);
        return Result.ok(commentCountVO2);
    }

    @PostMapping("post")
    /**
     * @description: 专题评论
     * @author wangzhuo
     * @date 2022-01-10 16:42
     * @version 1.0
     */
    public Result post( @RequestBody CommentPostBO2 commentPostBO2){
        CommentPostVO2 commentPostVO2 = commentService2.postSpecialComment(commentPostBO2);
        return Result.ok(commentPostVO2);
    }
}
